# annotation classes for read annotation from json file or former APIs
import json
from dataclasses import dataclass, field

@dataclass
class annotation:

    asm_file_name: str=''
    decomplie_file_name: str=''
    plt_sensitive_addr_dict: dict = field(default_factory=dict)
    direct_sensitive_dict: dict = field(default_factory=dict)
    inlined_func_dict: dict = field(default_factory=dict)
    decomplie_sensitive_dict: dict = field(default_factory=dict)

    def to_dict(self):
        return self.__dict__

    def __init__(self, asm_file_name='', decomplie_file_name=''):
        self.asm_file_name = asm_file_name
        self.decomplie_file_name = decomplie_file_name

@dataclass
class decomplie_sensitive_func:

    func_name: str=''
    caller_func_info_ls: list = field(default_factory=list)
    inline: bool=False

    def to_dict(self):
        return self.__dict__

@dataclass 
class decomplie_caller_func:

    func_name: str=''
    caller_func_list: list = field(default_factory=list)
    code: dict = field(default_factory=dict)
    call_address: str=''
    related_par_ls: list = field(default_factory=list)

    def to_dict(self):
        return self.__dict__

@dataclass
class plt_sensitive_func:
    
    func_name: str=''
    func_mem: str=''
    func_str: str=''
    def to_dict(self):
        return self.__dict__

@dataclass
class direct_sensitive_func:

    func_name: str=''
    caller_func_info_ls: list = field(default_factory=list)
    inline: bool=False
    
    def to_dict(self):
        return self.__dict__

@dataclass
class inline_sensitive_func:

    func_name_predict: str=''
    caller_func_info_ls: list = field(default_factory=list)
    inline: bool=True

    def to_dict(self):
        return self.__dict__

@dataclass
class asm_caller_func:
    
    func_name: str=''
    call_address: str=''
    basic_block: list = field(default_factory=list)
    code: dict = field(default_factory=dict)
    # if used by inline_sensitive_func, no need to store related_par_address
    related_par_address: dict = field(default_factory=dict)

    def to_dict(self):
        return self.__dict__


